package com.gqz.qrcode.api;

import com.gqz.common.core.constant.ServiceNameConstants;
import com.gqz.common.core.domain.R;
import com.gqz.qrcode.api.factory.RemoteQrcodeFallback;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 远程qrcode服务
 *
 * @author gqz20
 * @date 2023/02/11
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.QRCODE_SERVICE, fallbackFactory = RemoteQrcodeFallback.class)
public interface RemoteQrcodeService {
    /**
     * 得到qrcode base64
     *
     * @param content 内容
     * @return {@link R}
     */
    @GetMapping("/getQRCodeBase64")
    R getQRCodeBase64(@RequestParam("content") String content);

    /**
     * 得到qrcode
     *
     * @param response 响应
     * @param content  内容
     */
    @GetMapping("/getQRCode")
    void getQRCode(HttpServletResponse response, @RequestParam("content") String content);

    /**
     * 解密qrcode
     *
     * @param content 内容
     * @return {@link R}
     */
    @PostMapping("/decryptQRCode")
    R decryptQRCode(@RequestBody String content);
}
